package com.qqtech.qquan.homemaking.service;

import java.sql.Timestamp;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.common.exception.OrderException;
import com.qqtech.core.frame.model.Result;
import com.qqtech.core.frame.service.BaseService;
import com.qqtech.qquan.homemaking.model.HomemakingOrder;
import com.qqtech.qquan.homemaking.model.HomemakingOrderVo;

public interface HomemakingOrderService extends BaseService<HomemakingOrder> {
	public HomemakingOrderVo getByOrderNo(java.lang.String orderNo) ;
	
	/**
	 * 下单
	 * @param homemakingOrderVo
	 */
	public Result handleSaveOrder(HomemakingOrderVo homemakingOrderVo) throws OrderException;
	
	
	/**
	 * 更新状态为“已服务”
	 * @param orderNo 订单号
	 * @return
	 */
	public Result handleCompleteService(String orderNo) throws OrderException;
	
	/**
	 * 取消订单，X个小时外取消订单全额退款，X个小时内取消订单退款50%，开始服务时取消订单不给退款。
	 * @param orderNo
	 * @return X个小时外取消订单全额退款(percent:1),X个小时内取消订单退款50%(percent:0.5)，开始服务时取消订单不给退款(percent:0)。
	 */
	public Result handleCancelOrder(String orderNo);
	
	/**
	 * 确认服务完成，订单完成,家政服务的预约数量加1
	 * @param orderNo
	 * @return
	 * @throws OrderException
	 */
	public Result handleConfirmService(String orderNo);
	
	/**
	 * 获取某人某个时间段内的家政服务次数
	 * @param creatorId 发布人
	 * @param doneAtBegin 查询开始时间
	 * @param doneAtEnd 查询结束时间
	 * @return
	 */
	public int getServiceCount(Integer creatorId, Timestamp doneAtBegin, Timestamp doneAtEnd);
	
	/**
	 * 卖家-我的预约
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<HomemakingOrderVo> queryPageListBySeller(HomemakingOrder query, Pageable pageable);
	
	/**
	 * 卖家取消
	 * @param orderNo
	 * @return
	 */
	public Result handleCancelOrderBySeller(String orderNo);
}